//
//  PicBigViewController.m
//  PregnancyAPP
//
//  Created by APPYING on 14-2-11.
//  Copyright (c) 2014年 APPYING. All rights reserved.
//

#import "PicBigViewController.h"
#import "MobClick.h"

@interface PicBigViewController ()

@end

@implementation PicBigViewController
@synthesize weeks = _weeks;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:@"PicBigViewController"];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"PicBigViewController"];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithTitle:@"< Back"style:UIBarButtonItemStyleBordered target:self action:@selector(popToPreviousView)];
    self.navigationItem.leftBarButtonItem =leftItem;
    [leftItem release];

    self.title = [NSString stringWithFormat:@"孕期第%@周", self.weeks];
    NSDictionary *attributes=[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor,[UIFont fontWithName:@"YuppySC-Regular" size:20],UITextAttributeFont, nil];
    [self.navigationController.navigationBar setTitleTextAttributes:attributes];

    mainView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ImgMain"]];
    mainView.frame = CGRectMake(0, 60, Kheight, Kheight);
    mainView.userInteractionEnabled = YES;
    [self.view addSubview:mainView];
    [mainView release];
    
    version = [[UIDevice currentDevice].systemVersion doubleValue];

    //定义一个白色的背景，然后将图片贴在背景上面显示，这样会让图片看起来更好看
    UIView *whitePicBgView = [[UIView alloc] init];
    whitePicBgView.backgroundColor = [UIColor whiteColor];
    whitePicBgView.frame = CGRectMake(0, 65, Kheight, 239);
    
    [self.view addSubview:whitePicBgView];
    [whitePicBgView release];

    
    UIImageView *imgBig = [[UIImageView alloc] init];
    if([self.weeks isEqualToString:@"00"]) {
        self.weeks = @"01";
    }
    imgBig.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",self.weeks]];
    imgBig.frame = CGRectMake(0, 5, Kheight, 224);
    [whitePicBgView addSubview:imgBig];
    [imgBig release];
}

//返回上一个页面
- (void)popToPreviousView {
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
